package com.az.securitycommon.advice;

import com.az.miaoapi.response.ResponseCode;
import com.az.miaoapi.response.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class ExceptionAdvice {
    @ExceptionHandler(AccessDeniedException.class)
    public ResponseResult handleException(Exception e){
        log.error("e: ", e);
        return new ResponseResult(ResponseCode.INSUFFICIENT_PERMISSIONS);
    }
}
